class TextGame extends egret.Sprite{
	public textNum:egret.TextField;//分数值
	public textTitle:egret.Bitmap;//显示提示
	
	public greImg=RES.getRes("great_png");//成功
	public preImg=RES.getRes("perfect_png");//完美
	public endImg=RES.getRes("miss_png");//失败
	public constructor() {
		super();
		this.addEventListener(egret.Event.ADDED_TO_STAGE,this.textStart,this);
		this.creatTitle();
	};
	// 初始化
	private textStart(){
		// 分数
		var grade:egret.TextField = new egret.TextField();
		grade.text="分数:";//前面laber
		grade.size=20;
		grade.x =this.stage.stageWidth / 2.5;
		this.addChild(grade);
		
		// 分数值
		this.textNum = new egret.TextField();
		this.textNum.text="0";
		this.textNum.size=20;
		this.textNum.x = grade.x+grade.width;
		this.addChild(this.textNum);
	};
	// 显示提示
	private creatTitle() {
		// 成功的时候出现
		this.textTitle = new egret.Bitmap();
		this.textTitle.texture = this.preImg;
		this.textTitle.width = this.textTitle.texture.textureWidth / 3;
		this.textTitle.height = this.textTitle.texture.textureHeight / 3;
		this.textTitle.x = 375 / 2 - this.textTitle.width / 2;
		this.textTitle.y = 200;
		this.textTitle.visible = false;
		this.addChild(this.textTitle);
		
	}
	// 加分数
	public addNum(t) {
		let b = Number(this.textNum.text);//增加分数之前的值
		b += t;
		this.textNum.text =String(b);
	};
}